//导入组件
import Login from '@/pages/Login.vue'
import Register from '@/pages/Register.vue'
import Index from '@/pages/index.vue'
import Product from '@/pages/product.vue'
import Category from '@/pages/Category.vue'
import NotFound from '@/pages/NotFound.vue'
import Cart from '@/pages/Cart.vue'



//1.引入路由插件
import Vue from 'vue'
import Router from 'vue-router'
//2.路由初始化
Vue.use(Router)
//3.创建路由实例，并导出
export default new Router({
  routes: [
    //匹配到A路径，就强制跳转到B路径
    { path: '/', redirect: '/Index' },
    //定义：发什么请求，找哪个组件
    { path: '/Login', component: Login },
    { path: '/Register', component: Register },
    { path: '/Index', component: Index },
    { path: '/Product', component: Product },
    { path: '/Category', component: Category },
    { path: '/Cart', component: Cart },
    //当上面所有的路径都匹配不到时，报404
    { path: '*', component: NotFound },
  ]
})
